package com.lingx.web.api.impl;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import com.lingx.web.api.IApi;
@Component
public class Api9003 extends AbstractDevApi implements IApi{
	@Resource
	private JdbcTemplate jdbcTemplate;

	@Value("#{configs['database.name']}")
	private String table_schema="lingx";
	@Override
	public int getApiCode() {
		return 9003;
	}
	@Override
	public String getApiName() {
		return "获取数据库名列表";
	}
	@Override
	public Map<String, Object> api(Map<String, Object> param) {
		Map<String,Object> ret=IApi.getRetMap(1, "操作成功");
		ret.put("data", this.jdbcTemplate.queryForList("SELECT table_name table_name,engine engine,table_rows table_rows,create_time create_time,table_collation table_collation from information_schema.TABLES where table_type='BASE TABLE' and table_schema=? and table_name not like 'tlingx_%' order by table_name asc",table_schema));
		
		return ret;
	}

	public boolean isLog() {
		return false;
	}
}
